
QMAKE_TARGET_COMPANY = ZLJX
QMAKE_TARGET_PRODUCT = ep_vpn_client
QMAKE_TARGET_DESCRIPTION = ep_vpn_client
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2025 ZLJX

CONFIG += c++17

DEFINES += QTF_QMAKE_TARGET_ADD_TYPEEXT
DEFINES += QTF_QMAKE_TARGET_ADD_VERSION

win32{
    DEFINES += WIN32_LEAN_AND_MEAN
}

greaterThan(QT_MAJOR_VERSION, 4) {
    TARGET_ARCH=$${QT_ARCH}
} else {
    TARGET_ARCH=$${QMAKE_HOST.arch}
}

#定义SRC的根目录位置
QTF_TOP_SOURCE_DIR=$${PWD}

#定义系统动态库编译后存放的目录
QTF_TOP_BUILD_DIR=$${PWD}
#定义是否进行硬件初始化
#DEFINES +=QTF_MAKE_WITHOUT_HARDWARE

#定义区分编译方式
CONFIG(debug, debug|release) {
    message("build type debug")
    QTF_MAKE_BUILD_TYPE=debug
}else:CONFIG(release, debug|release)  {
    message("build type release")
    QTF_MAKE_BUILD_TYPE=release
    #DEFINES+=QT_NO_DEBUG_OUTPUT  release时屏蔽qdebug消息
}

#根据编译类型修改输出文件名
defineReplace(tqlibProductTarget) {
    #unset(LIBRARY_NAME)
    T_LIBRARY_NAME = $$1
    contains(DEFINES, QTF_QMAKE_TARGET_PRODUCT_ADDTO_LIBRARYNAME):!isEmpty(QMAKE_TARGET_PRODUCT){
        return($${QMAKE_TARGET_PRODUCT}_$$T_LIBRARY_NAME)
    }else{
        return ($$T_LIBRARY_NAME)
    }
}
defineReplace(tqlibLibraryTypeTarget) {
    T_LIBRARY_NAME = $$1

    contains(DEFINES,QTF_QMAKE_TARGET_ADD_TYPEEXT):CONFIG(debug, debug|release) {
        !debug_and_release|build_pass {
            RET = $$member(T_LIBRARY_NAME, 0)-d
        }
   }

   isEmpty(RET):RET = $$T_LIBRARY_NAME
   return($$RET)
}


TARGET_SRC=$${TARGET}
TARGET_REAL=$${TARGET}

QMAKE_CC_LOWER = $$lower($$QMAKE_CC)
QMAKE_CC_SPLIT = $$split(QMAKE_CC_LOWER,'/')
unix{
    LIBS += -lrt
    contains(QTF_MAKE_GCC_TYPE,linux_arm_gcc_j6):{
        DEFINES += QTF_MAKE_LINUX_ARM_GCC_J6
        TARGET_REAL=$${TARGET}-j6
        !contains(TEMPLATE, "lib"):{
            TARGET=$${TARGET}-j6
        }

        QMAKE_CFLAGS +=-march=armv7-a -mfloat-abi=hard -mtune=cortex-a15
        QMAKE_CXXFLAGS  +=-march=armv7-a -mfloat-abi=hard -mtune=cortex-a15
    }else{
        contains(TARGET_ARCH, x86_64) {
            QTF_LIBS_DIR=$${QTF_TOP_SOURCE_DIR}/3rdparts/libs/x86_64-Linux
        } else {
            QTF_LIBS_DIR=$${QTF_TOP_SOURCE_DIR}/3rdparts/libs-x86-Linux
        }
        DEFINES += QTF_MAKE_LINUX_GCC
    }
}
win32 {
        contains(TARGET_ARCH, x86_64) {
            QTF_LIBS_DIR=$${QTF_TOP_SOURCE_DIR}/3rdparts/libs/x86_64-MSVC
        } else {
            QTF_LIBS_DIR=$${QTF_TOP_SOURCE_DIR}/3rdparts/libs-x86-MSVC
        }
        DEFINES += QTF_MAKE_WINDOWS_MSVC
}

#编译时，临时文件存放目录
QTF_LIB_BUILD_TEMPFILE_DIR =$$QTF_TOP_BUILD_DIR/build/$${TARGET_SRC}_build/$$QTF_MAKE_GCC_TYPE

#修改目标文件名，Debug模式下将文件名后加
#TARGET=$$tqlibProductTarget($$TARGET)

!contains(TEMPLATE, "lib"):{
    TARGET=$$tqlibLibraryTypeTarget($$TARGET)
}

contains(DEFINES, "lib_spdlog"):{
    INCLUDEPATH += $$QTF_LIBS_DIR/spdlog/include
    DEPENDPATH +=  $$QTF_LIBS_DIR/spdlog/include
    LIBS += -L$$QTF_LIBS_DIR/spdlog/lib -lspdlog
}

contains(DEFINES, "lib_tray"):{
    INCLUDEPATH += $$QTF_LIBS_DIR/tray/include
    DEPENDPATH +=  $$QTF_LIBS_DIR/tray/include
    INCLUDEPATH += /usr/include/gtk-3.0
    DEPENDPATH +=  /usr/include/gtk-3.0
    LIBS += -L$$QTF_LIBS_DIR/tray/lib -ltray
    INCLUDEPATH += /usr/include/glib-2.0
    DEPENDPATH +=  /usr/include/glib-2.0
    INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include
    DEPENDPATH +=  /usr/lib/x86_64-linux-gnu/glib-2.0/include
    INCLUDEPATH += /usr/include/pango-1.0
    DEPENDPATH +=  /usr/include/pango-1.0
    INCLUDEPATH += /usr/include/cairo
    DEPENDPATH +=  /usr/include/cairo
}

contains(DEFINES, "lib_toml11"):{
    INCLUDEPATH += $$QTF_LIBS_DIR/toml11/include
    DEPENDPATH +=  $$QTF_LIBS_DIR/toml11/include
}

contains(DEFINES, "lib_thread"):{
    unix:{
        LIBS+=-lpthread
    }
}

UI_DIR =      $${QTF_LIB_BUILD_TEMPFILE_DIR}/ui/$$QTF_MAKE_BUILD_TYPE
OBJECTS_DIR = $${QTF_LIB_BUILD_TEMPFILE_DIR}/obj/$$QTF_MAKE_BUILD_TYPE
MOC_DIR =     $${QTF_LIB_BUILD_TEMPFILE_DIR}/moc/$$QTF_MAKE_BUILD_TYPE
RCC_DIR =     $${QTF_LIB_BUILD_TEMPFILE_DIR}/rcc/$$QTF_MAKE_BUILD_TYPE


#应用程序生成的路径在程序代码根目录
#DESTDIR = $$OUT_PWD
DESTDIR=$$QTF_TOP_BUILD_DIR/build
DLLDESTDIR=$$QTF_TOP_BUILD_DIR/build

unix{
    QMAKE_CXXFLAGS  += -Wno-deprecated
}
